home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
002
/
chedit.arc
/
PCHR.I
< prev
next >
Wrap
Text File
|
1986-07-23
|
16KB
|
388 lines
{
This program is placed in the public domain by its author, William Couture.
Copyright (c) 1986 by DDI. All Rights Reserved.
}
type charset = array[0..1023] of byte; { character set array definition }
filename = string[80]; { a function must be passed a type }
charmessage = array[0..79] of integer; { a message "string" }
var coldseg,coldaddr:integer; { you can rename these to whatever you want,
as long as you change the references in the
getvect and restorevect routines. }
function readcset(var shapes:charset; fname:filename):integer;
var charfile: file of byte;
i:integer;
io:integer;
begin
assign(charfile,fname);
{$I-}
reset(charfile);
io := ioresult;
if (io = 0) then
begin
i := 0;
while((i < 1024) and (io = 0)) do
begin
read(charfile,shapes[i]);
io := ioresult;
i := i+1;
end;
end;
if (io = 0) then
readcset := 1 { everything OK }
else
readcset := -1; { something is wrong }
{$I+}
close(charfile);
end;
function writecset(var shapes:charset; fname:filename):integer;
var charfile: file of byte;
i:integer;
io:integer;
begin
assign(charfile,fname);
{$I-}
rewrite(charfile);
io := ioresult;
i := 0;
while ((i < 1024) and (io = 0)) do
begin
write(charfile,shapes[i]);
io := ioresult;
i := i+1;
end;
if (io = 0) then
writecset := 1 { everything OK }
else
writecset := -1; { something is wrong }
{$I+}
close(charfile);
end;
procedure getvect; { save the system vector before starting }
begin
coldaddr := memw[0:124];
coldseg := memw[0:126];
end;
procedure setvect(var shapes:charset); { set the vector to point to a table
defined by the programmer }
begin
memw[0:124] := ofs(shapes);
memw[0:126] := seg(shapes);
end;
procedure restorevect; { restore the system vector }
begin
memw[0:124] := coldaddr;
memw[0:126] := coldseg;
end;
procedure setbit(var shapes:charset; whichchar,row,col:integer);
{ NOTE: row,col are from 0..7, not 1..8
whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$46/<row/$03/$d8/$b9/$07/$00/$2b/$4e/<col/$b0/$01/$d2/
$e0/$26/$08/$07);
end;
procedure clearbit(var shapes:charset; whichchar,row,col:integer);
{ NOTE: row,col are from 0..7, not 1..8
whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$46/<row/$03/$d8/$b9/$07/$00/$2b/$4e/<col/$b0/$01/$d2/
$e0/$f6/$d0/$26/$20/$07);
end;
procedure xorbit(var shapes:charset; whichchar,row,col:integer);
{ NOTE: row,col are from 0..7, not 1..8
whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$46/<row/$03/$d8/$b9/$07/$00/$2b/$4e/<col/$b0/$01/$d2/
$e0/$26/$30/$07);
end;
procedure zerochar(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$7e/<whichchar/$d1/$e7/$d1/$e7/$d1/$e7/
$03/$fb/$fc/$b9/$08/$00/$33/$c0/$f3/$aa);
end;
procedure fillchar(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$7e/<whichchar/$d1/$e7/$d1/$e7/$d1/$e7/
$03/$fb/$fc/$b9/$08/$00/$b0/$ff/$f3/$aa);
end;
procedure inversechar(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$b9/$08/$00/$26/$80/$37/$ff/$43/$e2/$f9);
end;
procedure copychar(var shapes:charset; fromchar,intochar:integer);
{ NOTE: fromchar and intochar are 0..127 }
begin
inline($8c/$da/$c4/$5e/<shapes/$8c/$c0/$8e/$d8/$8b/$76/<fromchar/
$d1/$e6/$d1/$e6/$d1/$e6/$8b/$7e/<intochar/$d1/$e7/$d1/$e7/
$d1/$e7/$03/$f3/$03/$fb/$b9/$08/$00/$fc/$f3/$a4/$8e/$da);
end;
procedure horizflip(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$76/<whichchar/$d1/$e6/$d1/$e6/$d1/$e6/
$03/$de/$be/$00/$00/$b9/$04/$00/$26/$8a/$00/$f7/$de/$83/$c6/
$07/$26/$8a/$20/$26/$88/$00/$83/$ee/$07/$f7/$de/$26/$88/$20/
$46/$e2/$e7);
end;
procedure vertflip(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$ba/$08/$00/$b9/$08/$00/$33/$c0/$26/$8a/$07/$d0/$c0/
$d0/$dc/$e2/$fa/$26/$88/$27/$43/$4a/$75/$eb);
end;
procedure exchangerc(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($8b/$dc/$83/$eb/$02/$b9/$08/$00/$36/$c6/$07/$00/$4b/$e2/$f9/
$c4/$76/<shapes/$8b/$5e/<whichchar/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$f3/$ba/$08/$00/$b9/$08/$00/$8b/$dc/$83/$eb/$02/$26/$8a/
$04/$d0/$c0/$36/$d0/$17/$4b/$e2/$f8/$46/$4a/$75/$e9/$83/$ee/
$08/$8b/$dc/$83/$eb/$02/$b9/$08/$00/$36/$8a/$07/$26/$88/$04/
$46/$4b/$e2/$f6);
end;
procedure shiftdown(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$be/$07/$00/$b9/$07/$00/$26/$8a/$40/$ff/$26/$88/$00/
$4e/$e2/$f6/$26/$c6/$07/$00);
end;
procedure shiftup(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$76/<whichchar/$d1/$e6/$d1/$e6/$d1/$e6/
$03/$de/$be/$00/$00/$b9/$07/$00/$26/$8a/$40/$01/$26/$88/$00/
$46/$e2/$f6/$26/$c6/$47/$07/$00);
end;
procedure shiftleft(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$b9/$08/$00/$26/$d0/$27/$43/$e2/$fa);
end;
procedure shiftright(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$b9/$08/$00/$26/$d0/$2f/$43/$e2/$fa);
end;
procedure rotatedown(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$83/$c3/$07/$26/$8a/$27/$b9/$07/$00/$26/$8a/$47/$ff/
$26/$88/$07/$4b/$e2/$f6/$26/$88/$27);
end;
procedure rotateup(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$26/$8a/$27/$b9/$07/$00/$26/$8a/$47/$01/$26/$88/$07/
$43/$e2/$f6/$26/$88/$27);
end;
procedure rotateleft(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$b9/$08/$00/$26/$d0/$07/$43/$e2/$fa);
end;
procedure rotateright(var shapes:charset; whichchar:integer);
{ NOTE: whichchar is 0..127 }
begin
inline($c4/$5e/<shapes/$8b/$46/<whichchar/$d1/$e0/$d1/$e0/$d1/$e0/
$03/$d8/$b9/$08/$00/$26/$d0/$0f/$43/$e2/$fa);
end;
procedure grchar(whichchar,color:integer);
{ NOTE: whichchar is 0..127 OR 128..255
color is 0..3 in 320x200 mode, 0..1 in 640x200 mode
Adding 128 ($80) to the color will XOR draw the
character on top of the existing screen }
{ Currently, this routine always turns on the high bit, making
the character a graphics character. If you wish to use
0..127 as graphics characters and 128..255 as the regular
characters, change the $0c after the <whichchar to a $04
i.e. <whichchar/$0c becomes <whichchar/$04 }
begin
inline($b4/$09/$8a/$46/<whichchar/$0c/$80/$8a/$5e/<color/$b9/
$01/$00/$55/$cd/$10/$5d);
end;
procedure gratchar(row,col,whichchar,color:integer);
{ NOTE: whichchar is 0..127 OR 128..255
row is 1..25
col is 1..40 in 320x200 mode, 1..80 in 640x200 mode
color is 0..3 in 320x200 mode, 0..1 in 640x200 mode
Adding 128 ($80) to the color will XOR draw the
character on top of the existing screen }
{ Currently, this routine always turns on the high bit, making
the character a graphics character. If you wish to use
0..127 as graphics characters and 128..255 as the regular
characters, change the $0c after the <whichchar to a $04
i.e. <whichchar/$0c becomes <whichchar/$04 }
begin
inline($b4/$02/$8a/$76/<row/$fe/$ce/$8a/$56/<col/$fe/$ca/$b7/$00/$55/
$cd/$10/$5d/$b4/$09/$8a/$46/<whichchar/$0c/$80/$8a/$5e/<color/
$b9/$01/$00/$55/$cd/$10/$5d);
end;
procedure printbanner(row,col:integer; msg:charmessage; length,color:integer);
{ display a row of graphics characters }
{ Adding 128 ($80) to the color will XOR draw the characters on
top of the existing screen }
var i:integer;
begin
i := 0;
repeat
gratchar(row,col,msg[i],color);
col := col+1;
i := i+1;
until (i = length);
end;
procedure printcolumn(row,col:integer; msg:charmessage; length,color:integer);
{ display a column of graphics characters }
{ Adding 128 ($80) to the color will XOR draw the characters on
top of the existing screen }
var i:integer;
begin
i := 0;
repeat
gratchar(row,col,msg[i],color);
row := row+1;
i := i+1;
until (i = length);
end;
procedure bannerleft(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a banner 1 pixel left. This routine changes the contents
of the character set, not the screen. After the banner has been
rotate, it must be re-displayed for the change to be see on
the screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$da/$26/$8b/$37/$d1/$e6/
$d1/$e6/$d1/$e6/$03/$f7/$83/$c6/$07/$b4/$00/$b9/$08/$00/$8a/$04/
$d1/$c0/$4e/$e2/$f9/$8b/$4e/<length/$49/$78/$20/$8b/$d9/$d1/$e3/
$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/$03/$df/$be/$07/$00/
$8a/$00/$d1/$c0/$88/$00/$4e/$79/$f7/$49/$79/$e0/$1f);
end;
procedure bannerright(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a banner 1 pixel right. This routine changes the contents
of the character set, not the screen. After the banner has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$56/<shapes/$c4/$5e/<msg/$8b/$7e/<length/$4f/$78/$41/
$d1/$e7/$26/$8b/$31/$d1/$e6/$d1/$e6/$d1/$e6/$03/$f2/$83/$c6/$07/
$b4/$00/$b9/$08/$00/$8a/$04/$d1/$c8/$4e/$e2/$f9/$8b/$cf/$d1/$e9/
$8b/$fb/$8b/$df/$83/$c7/$02/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$da/$be/$07/$00/$8a/$00/$d1/$c8/$88/$00/$4e/$79/$f7/$49/
$79/$e1/$1f);
end;
procedure bannerup(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a banner 1 pixel up. This routine changes the contents
of the character set, not the screen. After the banner has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$4e/<length/$49/$78/$23/
$8b/$d9/$d1/$e3/$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$df/$be/$07/$00/$8a/$00/$88/$20/$8a/$e0/$4e/$79/$f7/$88/
$67/$07/$49/$79/$dd/$1f);
end;
procedure bannerdown(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a banner 1 pixel down. This routine changes the contents
of the character set, not the screen. After the banner has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$4e/<length/$49/$78/$26/
$8b/$d9/$d1/$d3/$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$df/$83/$c3/$08/$be/$f8/$ff/$8a/$00/$88/$20/$8a/$e0/$46/
$75/$f7/$88/$67/$f8/$49/$79/$da/$1f);
end;
procedure columnup(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a column 1 pixel up. This routine changes the contents
of the character set, not the screen. After the column has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$4e/<length/$49/$78/$2f/
$8b/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/03/$df/$8a/$27/
$8b/$d9/$d1/$e3/$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$df/$be/$07/$00/$8a/$00/$88/$20/$8a/$e0/$4e/$79/$f7/$49/
$79/$e0/$1f);
end;
procedure columndown(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a column 1 pixel down. This routine changes the contents
of the character set, not the screen. After the column has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$4e/<length/$49/$78/$36/
$8b/$d9/$d1/$e3/$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$df/$8a/$67/$07/$8b/$da/$83/$c2/$02/$26/$8b/$1f/$d1/$e3/
$d1/$e3/$d1/$e3/$03/$df/$83/$c3/$08/$be/$f8/$ff/$8a/$00/$88/$20/
$8a/$e0/$46/$75/$f7/$49/$79/$de/$1f);
end;
procedure columnright(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a column 1 pixel right. This routine changes the contents
of the character set, not the screen. After he column has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$4e/<length/$49/$78/$1c/
$8b/$d9/$d1/$e3/$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$df/$be/$07/$00/$d0/$08/$4e/$79/$fb/$49/$79/$e4/$1f);
end;
procedure columnleft(var shapes:charset; var msg:charmessage; length:integer);
{ Rotate a column 1 pixel left. This routine changes the contents
of the character set, not the screen. After the column has been
rotated, it must be re-displayed for the change to be seen on the
screen }
begin
inline($1e/$c5/$7e/<shapes/$c4/$56/<msg/$8b/$4e/<length/$49/$78/$1c/
$8b/$d9/$d1/$e3/$03/$da/$26/$8b/$1f/$d1/$e3/$d1/$e3/$d1/$e3/
$03/$df/$be/$07/$00/$d0/$00/$4e/$79/$fb/$49/$79/$e4/$1f);
end;